#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h> 
#include <stdlib.h>
#include <assert.h>
#include "app_platform/cntl_info.h"
#include "acaccountao.h"

using namespace erp::acaccount::ao;

CPP_SELF_DEFINE_START
/**
 *  请在这里增加自定义的成员变量和函数及其他内容，否则无法合并代码
 **/
#include "erp/comm/erp_errno_define.h"
#include "c2cplatform/library/string/string_helper.h"
#include "erp/comm/erp_macro_define.h"
#include "erp/acaccount/ddo/bankaccountddo_acaccount.h"
#include "erp/acaccount/ddo/bankaccountfilterddo_acaccount.h"
#include "erp/acaccount/to/bankaccountto_acaccount.h"
#include "erp/acaccount/to/bankaccountfilterto_acaccount.h"
#include "erp/comm/erp_yun_define.h"
#include "acaccountao_enum.h"

using namespace c2cent::library::wtimeelf;
using namespace c2cent::library::wwlog;
using namespace c2cplatform::library::string;
using namespace erp::comm;
using namespace erp::acaccount::dao;
using namespace erp::acaccount::to;
using namespace erp::acaccount::ddo;
using namespace erp::yun::comm;

//银行账户查询ITIL上报对象初始化
CItilGroup CACAccountAo::s_oGetBankAccountFilter(GETBANKACCOUNT_REQ,
		GETBANKACCOUNT_ERR, GETBANKACCOUNT_RSP, GETBANKACCOUNT_DEF);

//银行账户ByIds查询ITIL上报对象初始化
CItilGroup CACAccountAo::s_oGetBankAccountByIds(GETBANKACCOUNT_REQ,
		GETBANKACCOUNT_ERR, GETBANKACCOUNT_RSP, GETBANKACCOUNT_DEF);

//新增更新银行账户信息ITIL上报对象初始化
CItilGroup CACAccountAo::s_oAddAndUpdateBankAccount(GETBANKACCOUNT_REQ,
		GETBANKACCOUNT_ERR, GETBANKACCOUNT_RSP, GETBANKACCOUNT_DEF);

//逻辑删除银行账户信息ITIL上报对象初始化
CItilGroup CACAccountAo::s_oDeleteBankAccount(GETBANKACCOUNT_REQ,
		GETBANKACCOUNT_ERR, GETBANKACCOUNT_RSP, GETBANKACCOUNT_DEF);
CPP_SELF_DEFINE_END
/**
 *构建函数
 */
CACAccountAo::CACAccountAo(enum DeployMethod method)
{
}

/**
 *析构函数
 */
CACAccountAo::~CACAccountAo()
{
}

/**
 *每一次服务请求时，container都会调用此方法来清空数据
 */
void CACAccountAo::Reset()
{
}

int CACAccountAo::Initialize(IUserDefineCntl* pCntl)
{
	int iRetCode = 0;

	uint32_t dwLogSwitch = WLOG_OPEN | WLOG_KEY_OPEN | WLOG_ERR_OPEN;
	uint32_t dwCanLogRemote = 0;
	uint32_t dwPageSizeLimit = ERP_YUN_PAGESIZE_MIN;
	std::string strLogModule = "ao_acaccount";
	std::string strValidProperty = "0,1,2";

	std::cout << "File:" << __FILE__ << " Complie Date: " << __DATE__ << " "
			<< __TIME__ << std::endl;

	GetUintConfig(LogSwitch);
	GetStringConfig(LogModule);
	GetStringConfig(ValidProperty);
	GetUintConfig(CanLogRemote);
	GetUintConfig(PageSizeLimit);

	//uint32_t CACAccountAo::s_dwPageSizeLimit = 50;

	std::set<std::string> setItem;

	SplitStringIntoSet(strValidProperty.c_str(), ",", setItem);

	// 初始化日志
	if (C2C_WWLOG->QuickInitForAPP2(strLogModule.c_str(),B2B2CWW_LOG_APP_FILE_PATH, dwCanLogRemote, dwLogSwitch)!= 0)
	{
		std::cerr << "C2C_WWLOG->QuickInitForAPP2 Failed" << std::endl;
		return -1;
	}
	C2C_WW_LOG("C2C_WWLOG->QuickInitForAPP2 OK!");

	return iRetCode;
}

/**
 *
 *  通过SysNos获取银行账户信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set sysNoList: 银行账户SysNo数组，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map bankAccount: 银行账户信息列表  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::GetBankAccountBySysNos(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId, const std::set<uint64_t>& setSysNoList,
		const std::string& strInReserve, std::string& strErrmsg,
		std::map<uint64_t, erp::acaccount::po::CBankAccountPo>& mapBankAccount,
		std::string& strOutReserve)
{
	int iRetCode = 0;

	m_strMachineKey = strMachineKey;
	m_strSource = strSource;
	m_dwSceneId = dwSceneId;
	m_dwOperatorUin = rCntlInfo.getOperatorUin();

	C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u",
			__FUNCTION__, m_dwOperatorUin, strMachineKey.c_str(),
			strSource.c_str(), dwSceneId);

	//打印性能日志的同时进行接口的itil上报
	C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode,&s_oGetBankAccountByIds);

	iRetCode = CheckCommPara();
	if (iRetCode != 0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	std::map<uint64_t, CBankAccountDdo> mapBankAccountDdo;

	//调用DAO方法搜索数据
	iRetCode = m_cACAccountDaoStub4App.GetBankAccountBySysNos(rCntlInfo,
			m_strMachineKey, m_strSource, m_dwSceneId, setSysNoList,
			strInReserve, strErrmsg, mapBankAccountDdo, strOutReserve);

	if (iRetCode != 0)
	{
		//记录方法查询失败日志
		C2C_WW_LOG_ERR(iRetCode,
				"GetBankAccountByIds Failed! SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				m_dwSceneId, m_dwOperatorUin, m_strMachineKey.c_str(),
				m_strSource.c_str(), m_dwSceneId, strErrmsg.c_str());

		//记录失败原因
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);

		return iRetCode;
	}

	std::map<uint64_t, CBankAccountDdo>::const_iterator it =
			mapBankAccountDdo.begin();
	for (; it != mapBankAccountDdo.end(); it++)
	{
		CBankAccountPo oBankAccountPo;
		CBankAccountDdoConvCBankAccountPo::Conv_CBankAccountDdo_To_CBankAccountPo(
				it->second, oBankAccountPo);
		mapBankAccount[it->first] = oBankAccountPo;
	}

	C2C_WW_LOG(
			"GetBankAccountByIds Passed! Size:%zu SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
			mapBankAccountDdo.size(), m_dwSceneId, m_dwOperatorUin,
			m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId,
			strErrmsg.c_str());

	return iRetCode;
}

/**
 * 检查新增修改方法的银行账户PO字段是否正确
 *@author WilliamXu
 *@version 1.0, 2013-10-22
 *
 */
int32_t CACAccountAo::CheckBankAccountPo(
		erp::acaccount::po::CBankAccountPo poBankAccount)
{
	int iRetCode = 0;

	//账户名称
	if (poBankAccount.IsBankAccountNameSet()
			&& LENGTH_BankAccountName
					< poBankAccount.GetBankAccountName().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BankAccountName Error! BankAccountName:%s BankAccountNameLimitSize:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				poBankAccount.GetBankAccountName().c_str(),
				LENGTH_BankAccountName, m_dwOperatorUin,
				m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId);
		return iRetCode;
	}

	//银行账号
	if (poBankAccount.IsBankAccountSet()
			&& LENGTH_BankAccount < poBankAccount.GetBankAccount().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BankAccount Error! BankAccount:%s BankAccountLimitSize:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				poBankAccount.GetBankAccount().c_str(), LENGTH_BankAccount,
				m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(),
				m_dwSceneId);
		return iRetCode;
	}

	//银行类型
	if (poBankAccount.IsBankTypeSet()
			&& LENGTH_BankType < poBankAccount.GetBankType().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BankType Error! BankType:%s BankTypeLimitSize:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				poBankAccount.GetBankType().c_str(), LENGTH_BankType,
				m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(),
				m_dwSceneId);
		return iRetCode;
	}

	//开户行
	if (poBankAccount.IsBranchBankSet()
			&& LENGTH_BranchBank < poBankAccount.GetBranchBank().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BranchBank Error! BranchBank:%s BranchBankLimitSize:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				poBankAccount.GetBranchBank().c_str(), LENGTH_BranchBank,
				m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(),
				m_dwSceneId);
		return iRetCode;
	}

	//备注
	if (poBankAccount.IsCommentSet()
			&& LENGTH_Comment < poBankAccount.GetComment().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"Comment Error! Comment:%s CommentLimitSize:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				poBankAccount.GetComment().c_str(), LENGTH_Comment,
				m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(),
				m_dwSceneId);
		return iRetCode;
	}

	return iRetCode;
}

/**
 * 检查通用必填字段是否正确
 *@author WilliamXu
 *@version 1.0, 2013-10-22
 *
 */
int32_t CACAccountAo::CheckCommPara()
{
	int iRetCode = 0;

	if (m_strMachineKey.empty())
	{
		iRetCode = ERR_ERP_COMMON_MACHINEKEY_INVALID;
		C2C_WW_LOG_ERR(iRetCode,
				"MachineKey Error! MachineKey:%s OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				m_strMachineKey.c_str(), m_dwOperatorUin,
				m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId);
		return iRetCode;
	}

	if (m_strSource.empty())
	{
		iRetCode = ERR_ERP_COMMON_SOURCE_INVALID;
		C2C_WW_LOG_ERR(iRetCode,
				"Source Error! Source:%s OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				m_strSource.c_str(), m_dwOperatorUin, m_strMachineKey.c_str(),
				m_strSource.c_str(), m_dwSceneId);
		return iRetCode;
	}

	if (m_dwSceneId == 0)
	{
		iRetCode = ERR_ERP_COMMON_SCENEID_INVALID;
		C2C_WW_LOG_ERR(iRetCode,
				"SceneId Error! SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				m_dwSceneId, m_dwOperatorUin, m_strMachineKey.c_str(),
				m_strSource.c_str(), m_dwSceneId);
		return iRetCode;
	}

	return iRetCode;
}

/**
 * 验证查询对象是否正确
 *@author WilliamXu
 *@version 1.0, 2013-10-22
 *
 */
int32_t CACAccountAo::CheckBankAccountFilter(
		const CBankAccountFilterPo& oBankAccountFilter)
{
	int iRetCode = 0;

	//账户名称
	if (oBankAccountFilter.IsBankAccountNameSet()
			&& LENGTH_BankAccountNameFilter
					< oBankAccountFilter.GetBankAccountName().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BankAccountName Error! BankAccountName:%s MaxLimit:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				oBankAccountFilter.GetBankAccountName().c_str(),
				LENGTH_BankAccountNameFilter, m_dwOperatorUin,
				m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId);
		return iRetCode;
	}

	//银行账号
	if (oBankAccountFilter.IsBankAccountSet()
			&& LENGTH_BankAccountFilter
					< oBankAccountFilter.GetBankAccount().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BankAccount Error! BankAccount:%s MaxLimit:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				oBankAccountFilter.GetBankAccount().c_str(),
				LENGTH_BankAccountFilter, m_dwOperatorUin,
				m_strMachineKey.c_str(), m_strSource.c_str(), m_dwSceneId);
		return iRetCode;
	}

	//银行账号
	if (oBankAccountFilter.IsBankTypeSet()
			&& LENGTH_BankTypeFilter < oBankAccountFilter.GetBankType().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BankType Error! BankType:%s MaxLimit:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				oBankAccountFilter.GetBankType().c_str(), LENGTH_BankTypeFilter,
				m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(),
				m_dwSceneId);
		return iRetCode;
	}

	//银行账号
	if (oBankAccountFilter.IsBranchBankSet()
			&& LENGTH_BranchBankFilter
					< oBankAccountFilter.GetBranchBank().size())
	{
		iRetCode = ERR_ERP_YUN_NAMESIZE_OVERFLOW;
		C2C_WW_LOG_ERR(iRetCode,
				"BranchBank Error! BranchBank:%s MaxLimit:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u",
				oBankAccountFilter.GetBankType().c_str(), LENGTH_BankTypeFilter,
				m_dwOperatorUin, m_strMachineKey.c_str(), m_strSource.c_str(),
				m_dwSceneId);
		return iRetCode;
	}

	return iRetCode;
}

/**
 *
 *  获取银行账户信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param BankAccountFilterPo bankAccountFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector bankAccount: 银行信息列表  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::GetBankAccountByFilter(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId,
		const erp::acaccount::po::CBankAccountFilterPo& oBankAccountFilter,
		const std::string& strInReserve, std::string& strErrmsg,
		std::vector<erp::acaccount::po::CBankAccountPo>& vecBankAccount,
		std::string& strOutReserve)
{
	int iRetCode = 0;

	m_strMachineKey = strMachineKey;
	m_strSource = strSource;
	m_dwSceneId = dwSceneId;
	m_dwOperatorUin = rCntlInfo.getOperatorUin();

	C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u",
			__FUNCTION__, m_dwOperatorUin, strMachineKey.c_str(),
			strSource.c_str(), dwSceneId);

	//打印性能日志的同时进行接口的itil上报
	C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode,&s_oGetBankAccountFilter);

	//验证通用参数是否正确
	iRetCode = CheckCommPara();
	if (iRetCode != 0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	//验证查询对象是否正确
	iRetCode = CheckBankAccountFilter(oBankAccountFilter);
	if (iRetCode != 0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	CBankAccountFilterDdo oBankAccountFilterDdo;
	CBankAccountFilterDdoConvCBankAccountFilterPo::Conv_CBankAccountFilterPo_To_CBankAccountFilterDdo(
			oBankAccountFilter, oBankAccountFilterDdo);

	std::vector<CBankAccountDdo> vecBankAccountDdo;

	//调用DAO方法搜索数据
	iRetCode = m_cACAccountDaoStub4App.GetBankAccountByFilter(rCntlInfo,
			m_strMachineKey, m_strSource, m_dwSceneId, oBankAccountFilterDdo,
			strInReserve, strErrmsg, vecBankAccountDdo, strOutReserve);

	if (iRetCode != 0)
	{
		//记录方法查询失败日志
		C2C_WW_LOG_ERR(iRetCode,
				"GetBankAccountByFilter Failed! SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				m_dwSceneId, m_dwOperatorUin, m_strMachineKey.c_str(),
				m_strSource.c_str(), m_dwSceneId, strErrmsg.c_str());

		//记录失败原因
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);

		return iRetCode;
	}

	std::vector<CBankAccountDdo>::const_iterator it = vecBankAccountDdo.begin();
	for (; it != vecBankAccountDdo.end(); it++)
	{
		CBankAccountPo oBankAccountPo;
		CBankAccountDdoConvCBankAccountPo::Conv_CBankAccountDdo_To_CBankAccountPo(
				(*it), oBankAccountPo);
		vecBankAccount.push_back(oBankAccountPo);
	}

	return iRetCode;
}

/**
 *
 *  写入银行账户信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param BankAccountPo bankAccount: 银行信息ddo，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint64_t bankAccountSysNo: 银行账户SysNo 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::AddAndUpdateBankAccount(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId,
		const erp::acaccount::po::CBankAccountPo& oBankAccount,
		const std::string& strInReserve, std::string& strErrmsg,
		uint64_t& ddwBankAccountSysNo, std::string& strOutReserve)
{
	int iRetCode = 0;

	m_strMachineKey = strMachineKey;
	m_strSource = strSource;
	m_dwSceneId = dwSceneId;
	m_dwOperatorUin = rCntlInfo.getOperatorUin();

	C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u",
			__FUNCTION__, m_dwOperatorUin, strMachineKey.c_str(),
			strSource.c_str(), dwSceneId);

	//打印性能日志的同时进行接口的itil上报
	C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode,&s_oAddAndUpdateBankAccount);

	//验证通用参数是否正确
	iRetCode = CheckCommPara();
	if (iRetCode != 0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	//验证新增更新的PO是否正确
	iRetCode = CheckBankAccountPo(oBankAccount);
	if (iRetCode != 0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	//将PO转换为DDO
	CBankAccountDdo oBankAccountDdo;
	CBankAccountDdoConvCBankAccountPo::Conv_CBankAccountPo_To_CBankAccountDdo(
			oBankAccount, oBankAccountDdo);

	//调用DAO新增更新方法
	iRetCode = m_cACAccountDaoStub4App.AddAndUpdateBankAccount(rCntlInfo,
			m_strMachineKey, m_strSource, m_dwSceneId, oBankAccountDdo,
			strInReserve, strErrmsg, ddwBankAccountSysNo, strOutReserve);

	if (iRetCode != 0)
	{
		C2C_WW_LOG_ERR(iRetCode,
				"AddAndUpdateBankAccount Failed! SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				dwSceneId, rCntlInfo.getOperatorUin(), strMachineKey.c_str(),
				strSource.c_str(), dwSceneId, strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}
	return iRetCode;
}

/**
 *
 *  逻辑删除银行账户信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint64_t bankAccountSysNo: 银行账户SysNo  [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::DeleteBankAccount(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId, uint64_t ddwBankAccountSysNo,
		const std::string& strInReserve, std::string& strErrmsg,
		std::string& strOutReserve)
{
	int iRetCode = 0;

	m_strMachineKey = strMachineKey;
	m_strSource = strSource;
	m_dwSceneId = dwSceneId;
	m_dwOperatorUin = rCntlInfo.getOperatorUin();

	C2C_WW_LOG("GetAReq %s OpUin:%u MachineKey:%s Source:%s SceneId:%u",
			__FUNCTION__, m_dwOperatorUin, strMachineKey.c_str(),
			strSource.c_str(), dwSceneId);

	//打印性能日志的同时进行接口的itil上报
	C2C_TIME_ELF_ITIL oWTimeElf(C2C_WWLOG,__FUNCTION__,&iRetCode,&s_oDeleteBankAccount);

	//验证通用参数是否正确
	iRetCode = CheckCommPara();
	if (iRetCode != 0)
	{
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}

	//调用DAO逻辑删除方法
	iRetCode = m_cACAccountDaoStub4App.DeleteBankAccount(rCntlInfo,
			m_strMachineKey, m_strSource, m_dwSceneId, ddwBankAccountSysNo,
			strInReserve, strErrmsg, strOutReserve);

	if (iRetCode != 0)
	{
		C2C_WW_LOG_ERR(iRetCode,
				"DeleteBankAccount Failed! SceneId:%u OpUin:%u MachineKey:%s Source:%s SceneId:%u ErrMsg:%s",
				dwSceneId, rCntlInfo.getOperatorUin(), strMachineKey.c_str(),
				strSource.c_str(), dwSceneId, strErrmsg.c_str());
		C2C_WW_LOG_LAST_ERR_LOG(strErrmsg);
		return iRetCode;
	}
	return iRetCode;
}

/**
 *
 *  写入&更新经营类会计项目信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param ACItemsPo aCItemsPo: 经营类会计项目信息po，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param uint64_t aCItemsSysNo: 银行账户SysNo 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::AddAndUpdateACItems(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId, const erp::acaccount::po::CACItemsPo& oACItemsPo,
		const std::string& strInReserve, std::string& strErrmsg,
		uint64_t& ddwACItemsSysNo, std::string& strOutReserve)
{
	uint32_t dwRet = 0;
	//TODO:业务代码

	return dwRet;
}

/**
 *
 *  逻辑删除经营类会计项目信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param uint64_t ACItemsSysNo: 会计项目信息SysNo  [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::DeleteACItems(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId, uint64_t ddwACItemsSysNo,
		const std::string& strInReserve, std::string& strErrmsg,
		std::string& strOutReserve)
{
	uint32_t dwRet = 0;
	//TODO:业务代码

	return dwRet;
}

/**
 *
 *  通过SysNos获取经营类会计项目信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param Set sysNoList: 银行账户SysNo数组，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Map aACItems: 经营类会计项目信息PO列表  	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::GetACItemsBySysNos(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId, const std::set<uint64_t>& setSysNoList,
		const std::string& strInReserve, std::string& strErrmsg,
		std::map<uint64_t, erp::acaccount::po::CACItemsPo>& mapAACItems,
		std::string& strOutReserve)
{
	uint32_t dwRet = 0;
	//TODO:业务代码

	return dwRet;
}

/**
 *
 *  Filter过滤获取经营类会计项目信息
 *
 *@param String machineKey: 机器码，必填   [in]
 *@param String source: 调用来源，必填   [in]
 *@param uint32_t sceneId: 场景id，必填   [in]
 *@param ACItemsFilterPo bankAccountFilter: 过滤器，必填   [in]
 *@param String inReserve: 请求保留字   [in]
 *@param String errmsg: 错误信息  	[out]
 *@param Vector aCItems: 经营类会计项目信息 Po列表 	[out]
 *@param String outReserve: 返回保留字   	[out]
 *
 *@return  uint32_t : 0(成功) 其它失败
 *
 */
uint32_t CACAccountAo::GetACItemsByFilter(const CCntlInfo& rCntlInfo,
		const std::string& strMachineKey, const std::string& strSource,
		uint32_t dwSceneId,
		const erp::acaccount::po::CACItemsFilterPo& oBankAccountFilter,
		const std::string& strInReserve, std::string& strErrmsg,
		std::vector<erp::acaccount::po::CACItemsPo>& vecACItems,
		std::string& strOutReserve)
{
	uint32_t dwRet = 0;
	//TODO:业务代码

	return dwRet;
}
